import Taro, { Component } from '@tarojs/taro'
import NetWork from '../../util/network'
import './index.scss'
export default class Videodetail extends Component {
  state = {
    item: {}
  }
  componentDidMount() {
    this.initData()
  }
  config = {
    navigationBarTitleText: '视频详情',
    "usingComponents": {
      "txv-video": "plugin://tencentvideo/video"
    }
  }
 
  async initData() {
    let result = await NetWork({
      url: '/api/homepage/apiGetAppHomePageDtatil',
      data: {
        id: this.$router.params.id
      },
      method: 'post'
    })
    this.setState({
      item: result.item
    })
  }
  render() {
    let { item } = this.state
    return (
      <View className='infowarp'>
        <View className='componentsPage'>
          <txv-video
            height='490rpx'
            vid={item.videoUrl}   // 可使用vid="{{vid}}" wx:if="{{vid}}" 的方式应用data变量,要注意确保vid存在，详情可见文档最后面的tips
            playerid="txv1"     //playerid必须要全局唯一，可以设置为vid
            autoplay="{{true}}" // 是否自动播放
          ></txv-video>
        </View>
        <View className='footerInfo'>
          <View className="title">
            {item.tittle}
          </View>
          <View className="content">
            {item.digest}
          </View>
        </View>
      </View>
    )
  }
}